<?php 



	/*
	*	info: Featured Items
	*/
	
 	$category = shopperpress_getcat($_REQUEST);

	//$category = $wp_query->get_queried_object();
	$GLOBALS['shopperpress']['page_catID'] = $category->cat_ID;

	if(get_option("display_view") =="yes"){ ?>

	<div class="ListViewNav">
	<a href="<?php echo bloginfo('url'); ?>/index.php?cat=<?php echo $category->cat_ID; ?>" style="text-decoration:none;" title="Gallery View" <?php if(get_option("analytics_tracking") =="yes"){ ?>onclick="pageTracker._trackEvent('HOME PAGE', 'Page View', 'Gallery View');"<?php } ?>><?php echo SPEC($GLOBALS['_LANG']['_galleryview']) ?></a> 
	<a href="<?php echo bloginfo('url'); ?>/index.php?cat=<?php echo $category->cat_ID; ?>&type=1" style="text-decoration:none;" title="List View" <?php if(get_option("analytics_tracking") =="yes"){ ?>onclick="pageTracker._trackEvent('HOME PAGE', 'Page View', 'List View');"<?php } ?>><?php echo SPEC($GLOBALS['_LANG']['_listview']) ?></a>
	</div>

	<?php } ?>

	<h2 class="h2top"><?php echo SPEC($GLOBALS['_LANG']['_featuredproducts']) ?></h2>

	<?php

	 if($category->description !=""){ echo "<p>".$category->description."</p>"; }
	?>

	<?php include("_navigation.php"); ?>

	<?php if( !isset($_GET['sort']) && ( get_option("analytics_code") =="gallery" || !isset($_GET['type'])) ){ ?>	
	 
	<?php if($GLOBALS['adminads'] ==1){ 
	
	if(file_exists(FilterPath()."/wp-content/themes/shopperpress/ads/_ad_search_top.php.php")){ 
			include(FilterPath()."/wp-content/themes/shopperpress/ads/_ad_search_top.php.php");
	}
	
	 } ?>
	
		<div id="FeaturedProducts">
	
			 <ul class="ProductList<?php echo $GLOBALS['SP_LAY_CONTENT_LIST'] ?>">
			
			<?php 

 
			if(!empty($_GET['sort'])){
			
			$orderby=trim(strip_tags($_GET['sort']));
			$order=trim(strip_tags($_GET['order']));
			$key=trim(strip_tags($_GET['key']));
			$value=trim(strip_tags($_GET['value']));
			$compare=trim(strip_tags($_GET['compare']));
			
			}else{
			
				$order=trim(get_option("display_defaultorder"));
				$obz = explode("*",$order);
				
			}
 			//&meta_key='.$key.'&meta_value='.$value.'
				
			$posts = query_posts($query_string . '&orderby='.$obz[0].'&order='.$obz[1].'&exclude='.get_option("article_cats"));

			$cc=1;   $adID=1;
			while (have_posts()) : the_post();
	 
				$DisplaayImage = get_post_meta($post->ID, "thumbnail", true);
				if($DisplaayImage ==""){

					$DisplaayImage = get_post_meta($post->ID, "image", true);
				}
 				 
				$oldPrice = get_post_meta($post->ID, "old_price", true);
				$FoundShipping = get_post_meta($post->ID, "shipping", true);

				// ADMIN ADD SETUP OPTIONS
				if($GLOBALS['adminads'] ==1){

				if($cc==5){					
					
					if(file_exists(FilterPath()."/wp-content/themes/shopperpress/ads/_ad_middle_".$adID.".php")){ 
						include(FilterPath()."/wp-content/themes/shopperpress/ads/_ad_middle_".$adID.".php");
					}						 
						  
					$cc=0;  $adID++;
					
				}else{
 
					if(file_exists(FilterPath()."/wp-content/themes/shopperpress/themes/".$GLOBALS['shopperpress']['theme'].'/_item.php')){
					
						include(FilterPath()."/wp-content/themes/shopperpress/themes/".$GLOBALS['shopperpress']['theme'].'/_item.php');
					
					}else{
						include("_item.php");
					
					}

				}

				}else{

					if(file_exists(FilterPath()."/wp-content/themes/shopperpress/themes/".$GLOBALS['shopperpress']['theme'].'/_item.php')){
					
						include(FilterPath()."/wp-content/themes/shopperpress/themes/".$GLOBALS['shopperpress']['theme'].'/_item.php');
					
					}else{
						include("_item.php");
					
					}
				}



			$cc++;
			 endwhile; ?>
	
			 </ul>
			<br class="Clear" />
	
		  </div><!--FeaturedProducts-->	
	 
			 
	<?php }else{ ?>

			<br />
			<div class="listing">

				<div class="head">
				
					<span class="name">
					<?php _e('Item Name','cp'); ?>
					<a href="?sort=title&order=asc"><img src="<?php bloginfo('template_url'); ?>/images/sortup.gif" border="0" alt="sort up" /></a><a href="?sort=title&order=desc"><img src="<?php bloginfo('template_url'); ?>/images/sortdown.gif" border="0" /></a>
					</span>
					
					<span class="price">
					<?php if($GLOBALS['shopperpress']['price_tag'] !="no"){ ?><?php _e('Price','cp'); ?>
					<a href="?sort=meta_value&key=price&order=asc"><img src="<?php bloginfo('template_url'); ?>/images/sortup.gif" border="0" alt="sort down"/></a><a href="?sort=meta_value&key=price&order=desc"><img src="<?php bloginfo('template_url'); ?>/images/sortdown.gif" border="0" /></a>
					<?php } ?>
					</span>				

					<span class="date"></span>
					
					<div class="clear"></div>
				</div>

				<div class="list">
					<?php 
					$i = 1; 


					
					
					$orderby=trim(strip_tags($_GET['sort']));
					$order=trim(strip_tags($_GET['order']));
					$key=trim(strip_tags($_GET['key']));
					$value=trim(strip_tags($_GET['value']));
					$compare=trim(strip_tags($_GET['compare']));
					if(!empty($_GET['sort'])){
					}else{
					
						$order=trim(get_option("display_defaultorder"));
						
					}
						
					$posts = query_posts($query_string . '&post_type=post&orderby='.$order.'&order='.$order.'&meta_key='.$key.'&meta_value='.$value.'&exclude='.get_option("article_cats"));

					if (have_posts()) : ?>
					
					<?php while (have_posts()) : the_post(); ?>
					
					<?php if ($i % 2 == 0) { $alt = " class=\"alt\""; } else { $alt = " class=\"no\""; } echo "<div" . $alt;
					if (is_sticky()) { echo " id='sticky' "; } echo ">"; 
 					$oldPrice = get_post_meta($post->ID, "old_price", true);
					?>
						
					<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" <?php if(get_option("analytics_tracking") =="yes"){ ?>onclick="pageTracker._trackEvent('HOME PAGE', 'List View Items', '<?php the_title(); ?>');"<?php } ?>>
									
					<?php if ( get_option('main_page_img') != "no" ) { ?>

						<span class="image">	
							<?php 

								$images = get_post_meta($post->ID, "image", true);
 
								if ($images =="") {?>
								<div class="main_page_no_img"><img src="<?php bloginfo('template_url'); ?>/images/no-pic.png" alt="No Photo" border="0" style="width:65px; height:65px; border:1px solid black;" /></div></span>
								<?php } else { ?>
								<div class="main_page_img" style="background: #FFF url(<?php echo SPImage($images,"m"); ?>) center no-repeat"></div></span>
								<?php } } ?>
								
								<span class="item" style="line-height:20px;"><div style="text-decoration:underline; font-weight:bold;"><?php if ( strlen(get_the_title()) > 45 ) { echo substr(get_the_title(), 0, 45)."..."; } else { the_title(); } ?></div>
								<?php echo substr(strip_tags($post->post_excerpt), 0, 75)."...";?></span>

								<span class="price">
								<?php if($GLOBALS['shopperpress']['price_tag'] !="no"){ ?>
								<?php echo $_SESSION['currency_symbol']; ?> <?php echo GetPrice(get_post_meta($post->ID, "price", true)); ?> <br />
								<?php if(strlen($oldPrice) > 1){ ?><strike><?php echo $_SESSION['currency_symbol']; ?> <?php echo get_post_meta($post->ID, "old_price", true); ?></strike><?php } ?>
								<?php } ?>

								</span>
								
								<span class="date">
 
								<?php if(get_option("display_cart") =="yes"){ ?><div class="ProductAdd"><a href="#"  onclick="<?php echo getBuyLink($post); ?> <?php if(get_option("analytics_tracking") =="yes"){ ?>pageTracker._trackEvent('HOME PAGE', 'Add Cart', '<?php the_title(); ?>');<?php } ?>" title="<?php echo SPEC($GLOBALS['_LANG']['_add']) ?>" style="color:white"><?php echo SPEC($GLOBALS['_LANG']['_add']) ?></a></div><?php } ?>
 
								</span>
							 
							<div class="clear"></div>
						</div>
                        <div class="clear"></div>
						</a>
					<?php $i++; unset($alt); ?>
					
					<?php endwhile; ?>
					 					
					<?php endif; ?>
					
				</div>
			</div>
		

<?php } ?>
 
<?php include("_navigation.php"); ?>

<div style="clear:both;"></div>